#include <stdio.h>
#define len 5

int inqueue(int *arr,int front,int rear,int data)
{
	if((rear+1)%len==front)
	{
		printf("full!!\n");
		return rear;
	}
	arr[rear%len]=data;
	rear++;
	return rear;
}

int outqueue(int *arr,int front,int rear)
{
	if(front==rear%len)
	{
		printf("empty!!\n");
	}
	front++;
	return front;	
}

int printqueue(int *arr,int front,int rear)
{
	int i=front;
	for(i=front;i<rear;i++)
	{
		printf(" %d ",arr[i]);
	}
	return 0;
}


int main(int argc, const char *argv[])
{
	int arr[len-1];
	int front=0;
	int rear=0;

	rear=inqueue(arr,front,rear,1);
	rear=inqueue(arr,front,rear,2);
	rear=inqueue(arr,front,rear,3);
	rear=inqueue(arr,front,rear,4);
	rear=inqueue(arr,front,rear,5);
	rear=inqueue(arr,front,rear,6);

	printqueue(arr,front,rear);

	printf("\n");

	front=outqueue(arr,front,rear);	

	printqueue(arr,front,rear);

	printf("\n");

	return 0;
}
